<?php $form=$this->beginWidget('CActiveForm', array(
	'id'=>'product-form',
	'enableAjaxValidation'=>false,
        'htmlOptions' => array(
            "class" => "mainForm", 
            'enctype' => 'multipart/form-data',
        ),
)); ?>

<fieldset>
    <div class="widget first">
        <div class="head"><h5 class="iList"><?php echo $actionName . " Product " . $model->name; ?></h5></div>

	<div class="rowElem">
            <?php echo $form->labelEx($model, 'name'); ?>
            <div class="formRight"><?php echo $form->textField($model, 'name', array('size' => 60, 'maxlength' => 255, "class"=>"rightDir", "title"=>"Name")); ?></div>
            <?php echo $form->error($model, 'name', array("style"=>"color:red")); ?>
            <div class="fix"></div>
        </div>
        <div class="rowElem">
            <?php echo $form->labelEx($model, 'description'); ?>
            <div class="formRight">
                <?php
                $this->widget('application.extensions.ckeditor.CKEditorWidget', array(
                    "model" => $model,
                    "attribute" => 'description',
                    "defaultValue" => $model->description,
                    "config" => array(
                        "height"=> Constant::FORM_CKEDITOR_HEIGHT,
                        "width"=> Constant::FORM_CKEDITOR_WIDTH,
                    ),
                ));
                ?>
            </div>
            <?php echo $form->error($model, 'description', array("style"=>"color:red")); ?>
            <div class="fix"></div>
        </div>
        <div class="rowElem">
            <?php echo $form->labelEx($model, 'publicationDate'); ?>
            <div class="formRight"><?php echo $form->textField($model, 'publicationDate', array("class" => "datepicker")); ?></div>
            <?php echo $form->error($model, 'publicationDate', array("style"=>"color:red")); ?>
            <div class="fix"></div>
        </div>
	<div class="rowElem">
            <?php echo $form->labelEx($model, 'price'); ?>
            <div class="formRight"><?php echo $form->textField($model, 'price', array('size' => 60, 'maxlength' => 255, "class"=>"rightDir", "title"=>"Price")); ?></div>
            <?php echo $form->error($model, 'price', array("style"=>"color:red")); ?>
            <div class="fix"></div>
        </div>
	<div class="rowElem">
            <?php echo $form->labelEx($model, 'cost'); ?>
            <div class="formRight"><?php echo $form->textField($model, 'cost', array('size' => 60, 'maxlength' => 255, "class"=>"rightDir", "title"=>"Cost")); ?></div>
            <?php echo $form->error($model, 'cost', array("style"=>"color:red")); ?>
            <div class="fix"></div>
        </div>
	<div class="rowElem">
            <?php echo $form->labelEx($model, 'quantity'); ?>
            <div class="formRight"><?php echo $form->textField($model, 'quantity', array('size' => 60, 'maxlength' => 255, "class"=>"rightDir", "title"=>"Quantity")); ?></div>
            <?php echo $form->error($model, 'quantity', array("style"=>"color:red")); ?>
            <div class="fix"></div>
        </div>
	<div class="rowElem">
            <?php echo $form->labelEx($model, 'hardCover'); ?>
            <div class="formRight"><?php echo $form->textField($model, 'hardCover', array('size' => 60, 'maxlength' => 255, "class"=>"rightDir", "title"=>"Hard Cover")); ?></div>
            <?php echo $form->error($model, 'hardCover', array("style"=>"color:red")); ?>
            <div class="fix"></div>
        </div>
	<div class="rowElem">
            <?php echo $form->labelEx($model, 'publisher'); ?>
            <div class="formRight"><?php echo $form->textField($model, 'publisher', array('size' => 60, 'maxlength' => 255, "class"=>"rightDir", "title"=>"Publisher")); ?></div>
            <?php echo $form->error($model, 'publisher', array("style"=>"color:red")); ?>
            <div class="fix"></div>
        </div>
	<div class="rowElem">
            <?php echo $form->labelEx($model, 'language'); ?>
            <div class="formRight"><?php echo $form->textField($model, 'language', array('size' => 60, 'maxlength' => 255, "class"=>"rightDir", "title"=>"Language")); ?></div>
            <?php echo $form->error($model, 'language', array("style"=>"color:red")); ?>
            <div class="fix"></div>
        </div>
	<div class="rowElem">
            <?php echo $form->labelEx($model, 'author'); ?>
            <div class="formRight"><?php echo $form->textField($model, 'author', array('size' => 60, 'maxlength' => 255, "class"=>"rightDir", "title"=>"Author")); ?></div>
            <?php echo $form->error($model, 'author', array("style"=>"color:red")); ?>
            <div class="fix"></div>
        </div>
        <div class="rowElem">
            <?php echo $form->labelEx($model, 'dimensions'); ?>
            <div class="formRight"><?php echo $form->textField($model, 'dimensions', array('size' => 60, 'maxlength' => 255, "class"=>"rightDir", "title"=>"Dimensions")); ?></div>
            <?php echo $form->error($model, 'dimensions', array("style"=>"color:red")); ?>
            <div class="fix"></div>
        </div>
	<div class="rowElem">
            <?php echo $form->labelEx($model, 'productCategoryId'); ?>
            <div class="formRight"><?php echo CHtml::activeDropDownList($model, 'productCategoryId', ProductCategory::getAllParentCategoriesTracking()); ?></div>
            <?php echo $form->error($model, 'productCategoryId', array("style"=>"color:red")); ?>
            <div class="fix"></div>
        </div>
        <div class="rowElem">
            <?php echo $form->labelEx($model, 'file_upload_small'); ?>
            <div class="formRight"> <?php echo CHtml::activeFileField($model, 'file_upload_small'); ?></div>
            <?php echo $form->error($model, 'file_upload_small', array("style"=>"color:red")); ?>
            <div class="formRight">
            <?php 
            if ($model->smallImgUrl)
                echo CHtml::image( Yii::app()->request->baseUrl . Constant::PRODUCT_SMALL_IMG_FOLDER_DISPLAY . $model->smallImgUrl,"",array("width"=>"150", "height"=>"150"));
            ?>
            </div>
            <div class="fix"></div>
        </div>
        <div class="rowElem">
            <?php echo $form->labelEx($model, 'file_upload_big'); ?>
            <div class="formRight"> <?php echo CHtml::activeFileField($model, 'file_upload_big'); ?></div>
            <?php echo $form->error($model, 'file_upload_big', array("style"=>"color:red")); ?>
            <div class="formRight">
            <?php 
            if ($model->bigImgUrl)
                echo CHtml::image( Yii::app()->request->baseUrl . Constant::PRODUCT_BIG_IMG_FOLDER_DISPLAY . $model->bigImgUrl,"",array("width"=>"150", "height"=>"150"));
            ?>
            </div>
            <div class="fix"></div>
        </div>

	<?php echo CHtml::submitButton($model->isNewRecord ? 'Create' : 'Save', array("class" => "greyishBtn submitForm")); ?>
        <div class="fix"></div>
    </div>
</fieldset>
<?php $this->endWidget(); ?>
